(defun fixtitl (batname / )
  (if titl_txt_list
    (progn
      (if attupd nil (load "attupd" "\nFile ATTUPD.LSP not loaded! "))
      (COND
            ((>=(LENGTH titl_txt_list)5)
             (attupd "corpttbats" "TITLE_1/5" (NTH 0 titl_txt_list))
             (attupd "corpttbats" "TITLE_1/3" (NTH 1 titl_txt_list))
             (attupd "corpttbats" "TITLE_1" (NTH 2 titl_txt_list))
             (attupd "corpttbats" "TITLE_2/3" (NTH 3 titl_txt_list))
             (SETQ #5_txt NIL)
             (FOREACH n (MEMBER (NTH 4 titl_txt_list) titl_txt_list)
               (IF #5_txt
                 (SETQ #5_txt (STRCAT #5_txt " " n))
                 (SETQ #5_txt n)
               )
             )
             (attupd "corpttbats" "TITLE_1/5" (NTH 4 titl_txt_list))
             )
            ((EQ(LENGTH titl_txt_list)4)
             (attupd "corpttbats" "TITLE_1/4" (NTH 0 titl_txt_list))
             (attupd "corpttbats" "TITLE_1/2" (NTH 1 titl_txt_list))
             (attupd "corpttbats" "TITLE_2/2" (NTH 2 titl_txt_list))
             (attupd "corpttbats" "TITLE_4/4" (NTH 3 titl_txt_list))
             )
            ((EQ(LENGTH titl_txt_list)3)
             (attupd "corpttbats" "TITLE_1/3" (NTH 0 titl_txt_list))
             (attupd "corpttbats" "TITLE_1" (NTH 1 titl_txt_list))
             (attupd "corpttbats" "TITLE_3/3" (NTH 2 titl_txt_list))
             )
            ((EQ(LENGTH titl_txt_list)2)
             (attupd "corpttbats" "TITLE_1/2" (NTH 0 titl_txt_list))
             (attupd "corpttbats" "TITLE_2/2" (NTH 1 titl_txt_list))
             )
            ((EQ(LENGTH titl_txt_list)1)
             (attupd "corpttbats" "TITLE_1" (NTH 0 titl_txt_list))
             )
      )
      (SETQ titl_txt_list NIL)
    )
    nil
  )
  (SETQ sht_no_prefix NIL)
  (COND
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*01 GENERAL*")(SETQ sht_no_prefix "G-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*02 CIVIL*")(SETQ sht_no_prefix "C-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*03 STRUCTURAL*")(SETQ sht_no_prefix "S-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*04 ARCHITECTURAL*")(SETQ sht_no_prefix "A-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*05 P&ID*")(SETQ sht_no_prefix "PID-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*06 ENVIRONMENTAL*")(SETQ sht_no_prefix "EN-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*07 TELEMETRY*")(SETQ sht_no_prefix "T-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*08 ELECTRICAL*")(SETQ sht_no_prefix "E-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*09 MECHANICAL*")(SETQ sht_no_prefix "M-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*10 PLUMBING*")(SETQ sht_no_prefix "P-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*11 FIRE*")(SETQ sht_no_prefix "F-"))
    ((WCMATCH (STRCASE (GETVAR "DWGPREFIX")) "*12 LANDSCAPE*")(SETQ sht_no_prefix "L-"))
  )
  (setq this_name (getvar "dwgname"))
  (IF (WCMATCH this_name "*#*")
    (PROGN
      (SETQ this_cnt 1)
      (while (AND (WCMATCH this_name "*#*")(NOT(WCMATCH this_name "#*")))(SETQ this_name (SUBSTR this_name 2)this_cnt (1+ this_cnt)))
      (SETQ this_cnt2 this_cnt)
      (WHILE (WCMATCH this_name "#*")(SETQ this_name (SUBSTR this_name 2) this_cnt2 (1+ this_cnt2)))
      (setq sht_no_suffix (ITOA(ATOI(substr (getvar "dwgname") this_cnt (- this_cnt2 this_cnt)))))
    )
    (setq sht_no_suffix NIL)
  )
  (IF (AND sht_no_prefix sht_no_suffix)
    (attupd "corpttbats" "SHT_NO." (STRCAT sht_no_prefix sht_no_suffix))
  )
  (princ)
)